package com.rc.evcharger.common.type;


import com.rc.evcharger.common.constant.SocketConstant;

import java.lang.reflect.Field;

/**
 * 当前数据格式
 * @author kb
 */
public class CurrentData extends BaseType implements DataType {
    String measuringPoint; // 测量点号
    String[] codes; // 数据编码

    public CurrentData() {
        super();
    }

    public CurrentData(String gunNum, String[] codes, String source) {
        StringBuffer sb = new StringBuffer();

        if (SocketConstant.SOURCE_ZHUHAI.equalsIgnoreCase(source)) {
            sb.append("0")
                    .append((int) Math.pow(2, Integer.parseInt(gunNum)));
        } else {
            if (gunNum.length() < 2) {
                sb.append("0");
            }
            sb.append(gunNum);
        }
        for (int i = 0; i < 7; i++) {
            sb.append(SPLIT).append("00");
        }
        this.measuringPoint = sb.toString();
        this.codes = codes;
    }

    public String getMeasuringPoint() {
        return measuringPoint;
    }

    public void setMeasuringPoint(String measuringPoint) {
        this.measuringPoint = measuringPoint;
    }

    public String[] getCodes() {
        return codes;
    }

    public void setCodes(String[] codes) {
        this.codes = codes;
    }

    @Override
    public Object getValue(String dataStr) {
        return null;
    }

    @Override
    public boolean customField(Field field, StringBuffer sb) {
        return false;
    }
}
